<?php
/**
 * @author Demianchuk Dmitro
 * @email d.demianchuk@gmail.com
 * @date 07.01.12
 * @version 1.0
 * @package adminArea
 */
class CkEditorInput extends TextInput
{
	private function registerJsCss(){
		$ckeditor = Yii::app()->assetManager->publish(
			Yii::getPathOfAlias('ext.ckeditor'), true, -1, YII_DEBUG
		);
		Yii::app()->getClientScript()->registerScriptFile($ckeditor . '/ckeditor.js');
	}

	public function show(){
		$this->registerJsCss();
		$value = '';
		if($this->itemId!=0){
			$value = $this->getData($this->current,$this->relationName);
		}
		return $this->render('ckEditor', array(
			'name'=>$this->name,
			'value'=>$value,
		));
	}
}
